Skip to content

IDE links in the compact form ?p= (raw deflate, base64url) - #34

Merged
cedricvogel-leo merged 1 commit into
mainfrom
feature/compact-ide-links
Nov 6, 2026
Merged

cedricvogel-leo merged 1 commit into
mainfrom
feature/compact-ide-links

Conversation

@cedricvogel-leo

Copy link
Copy Markdown
Collaborator

P46: the embed's «IDE-Link kopieren» and «In IDE öffnen» write the IDE's compact share link. This needs glpython-edu.github.io#40, which reads it.

What changes

  • The link: the same JSON payload as before, its UTF-8 bytes compressed with raw deflate (level 9) and written as base64url without = padding, in ?p= (#p= beyond 8,192 characters). It's the same format as the IDE's «Teilen» (#40 has the details and a test vector) and about 40 % shorter.
  • fflate 0.8.3 is loaded from jsDelivr with an integrity hash, like lz-string: sha384-ETfVLWAUsU3zp3SpnQsPDbAyrF6jYv2w8aNYo6KtY2JuyxXhzYLOL7e0ATbLSIHP, identical to the npm package's file. It works synchronously, so the link is still built inside the tap (iPad: clipboard and new tab).
  • Fallback: where fflate doesn't load (blocked, or a page with an AMD loader that takes the global), the macro writes the old ?project= with lz-string, which the IDE reads too. The button is enabled once fflate has loaded, or once it has failed and lz-string has loaded.
  • Checked in the real player: fflate loads as a global there (no AMD define).

Checks

  • check:ready has two new cases. The libraries are served from node_modules (fflate and lz-string as devDependencies, the same bytes as on jsDelivr, so the integrity hashes hold).
    • With fflate: «IDE-Link kopieren» copies https://glpython-edu.github.io/?p=… in base64url. Node's zlib reads it as the block's two files with mainFile.
    • Without fflate: the copied link is ?project=…, which lz-string reads.
  • check-macro passes.
  • check:player wasn't run, since this doesn't touch the ready path.

Going live

  1. First glpython-edu.github.io#40 is merged and deployed. Otherwise a course's ?p= link would open an empty project in the old IDE.
  2. Then this PR; merging reaches the macro on main.
  3. Then a patch version bump per course, so the courses load the new macro.

Manual tests

Desktop (Chrome, Safari, Firefox), in a course after the bump:

  1. «IDE-Link kopieren»: the copied link starts with https://glpython-edu.github.io/?p= and opens the block's files in the IDE.
  2. ▾ «In IDE öffnen»: a new tab with the same project.
  3. With jsDelivr blocked (DevTools → network request blocking for fflate): the link is ?project=… and opens too.

iPad (Safari, external keyboard):

  1. «IDE-Link kopieren» copies right away, and the link opens in the IDE.
  2. «In IDE öffnen» opens a new tab.
  3. The button is reachable with Tab and works with Enter or Space.

Follow-ups (not done)

  • One more request: the page loads fflate (about 33 KB, 12 KB gzipped) in addition to lz-string. lz-string could go once no fallback is wanted.

🤖 Generated with Claude Code

«IDE-Link kopieren» and «In IDE öffnen» write the IDE's compact share
link (P46): the same JSON payload, its UTF-8 bytes in raw deflate (fflate
0.8.3 from jsDelivr, level 9, with SRI) as base64url without padding, in
?p= (#p= beyond 8,192 characters). Where fflate doesn't load, the old
?project= with lz-string, which the IDE reads too. check:ready covers
both, with the libraries served from node_modules.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@cedricvogel-leo
cedricvogel-leo merged commit 1e5390e into main Nov 6, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant